//
//  RSSignatureVC.m
//  RSTools
//
//  Created by thinkjoy on 2017/10/19.
//  Copyright © 2017年 杜瑞胜. All rights reserved.
//

#import "RSSignatureVC.h"
#import "PPSSignatureView.h"

@interface RSSignatureVC ()

@property (weak, nonatomic) IBOutlet PPSSignatureView *signattureV;

@property (weak, nonatomic) IBOutlet UIImageView *imageV;

@end

@implementation RSSignatureVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //添加监听者
    [self.signattureV addObserver: self forKeyPath: @"signatureImage" options: NSKeyValueObservingOptionNew context: nil];
}

/**
 *  监听属性值发生改变时回调
 */
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context
{
    self.imageV.image   =   self.signattureV.signatureImage;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    self.imageV.image   =   self.signattureV.signatureImage;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
